﻿@model Website.Models.Category

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<fieldset>
    <legend>Category</legend>

    <div class="display-label">Tên Danh Mục SP</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.CategoryName)
    </div>

    @if(Model.ParentCategoryID.HasValue)
    {
        <div class="display-label">Danh Mục Sản Phẩm Cha</div>
        <div class="display-field">
            @Html.DisplayFor(model => model.ParentCategory.CategoryName)
        </div>
    }

    <div class="display-label">Loại KH</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Gender)
    </div>

    <div class="display-label">Mã Danh Mục SP</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Code)
    </div>

    <div class="display-label">Hiển Thị Ngoài Trang Chủ</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Display)
    </div>

    <div class="display-label">Thứ Tự</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Index)
    </div>
</fieldset>

@if (!Model.ParentCategoryID.HasValue)
{
    <fieldset>
        <legend>Danh Mục SP Con</legend>
        @{ Html.RenderPartial("SubCategories", Model.SubCategories.OrderByDescending(c=>c.CategoryID)); }
    </fieldset>
}

<p>
    @Html.ActionLink("Edit", "Edit", new { id = Model.CategoryID }) |
    @if(!Model.ParentCategoryID.HasValue)
    {
        @Html.ActionLink("Create Sub Category", "CreateSubCategory", new { id = Model.CategoryID }) @:|
        @Html.ActionLink("Back to List", "Index")
    }
    else
    {
        @Html.ActionLink("Back to List", "Details", new{id=Model.ParentCategoryID})
    }
    
</p>
